package com.yylany.service.impl;

import com.yylany.mapper.CommentMapper;
import com.yylany.pojo.Comment;
import com.yylany.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * User  yyl
 * Description: house
 * Created by yaoyonglong on 2018/11/6 8:35
 */
@Service
public class CommentServiceImpl implements CommentService {
    @Autowired
    private CommentMapper commentMapper;


    @Override
    public List<Comment> getBlogComments(int id, int nub) {
        Example example = new Example(Comment.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userId", id);
        List<Comment> comments = commentMapper.selectByExample(example);
        return comments;
    }

    @Override
    public List<Comment> getHouseComments(Long id, int i) {
        Example example = new Example(Comment.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userId", id);
        List<Comment> comments = commentMapper.selectByExample(example);
        return comments;
    }
}
